﻿{% extends 'base.html' %}

{% block css %}
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
{% endblock %}

{% block js %}
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
    <script>
        hljs.initHighlightingOnLoad();

        {% if current_user.is_authenticated %}
            $(function () {
                $('.delete-blog').click(function () {
                    $('.modal-content').load('{{ url_for('blog.blog_delete', blog_id=current_blog.id) }}');
                    $('#myModal').modal('show')
                });
            });
        {% endif %}
    </script>
{% endblock %}

{% block right %}
    <div class="col-md-12 page-body">
        <div class="row">

            <div class="sub-title">
                <a href="{{ url_for('blog.blog_list') }}"><i class="icon-list"></i></a>
                <h1>{{ current_blog.title }}</h1>
            </div>

            <div class="col-md-12 content-page">
                <div class="col-md-12 blog-post">

                    <!-- Post Headline Start -->
                    <!-- <div class="post-title">
                        <h1>{{ current_blog.title }}</h1>
                    </div> -->
                    <!-- Post Headline End -->


                    <!-- Post Detail Start -->
                    <div class="post-info">
                        <span>{{ current_blog.publish_time }} / by <a href="#">{{ current_blog.user.nickname }}</a></span>
                        <div class="pull-right">
                            <a href="{{ url_for('blog.blog_list', category_id=current_blog.category_id) }}">
                                {{ current_blog.category.name }}
                            </a>
                            <i class="icon-eye blue-color padding-left-20"></i>
                            <span>
                                    {{ current_blog.blogviews.count() }}
                            </span>
                            <i class="glyphicon glyphicon-heart red-color"></i>
                            <span>
                                    {{ current_blog.bloglikes.count() }}
                            </span>
                            {% if current_user.is_authenticated %}
                            <a href="{{ url_for('blog.blog_edit', blog_id=current_blog.id) }}" target="_blank">
                                <i class="icon-pencil"></i>
                            </a>
                            <a href="#" class="delete-blog">
                                <i class="icon-trash"></i>
                            </a>
                            {% endif %}
                        </div>
                    </div>
                    <!-- Post Detail End -->

                    <!-- Post Content -->
                    <div id="post-content" class="post-content">
                        {{ current_blog.content|safe }}
                    </div>
                    <!-- -->

                    <!-- Post Author Bio Box Start -->
                    <div class="about-author margin-top-120 margin-bottom-50">

                        <div class="picture">
                            <img src="{{ url_for('static', filename='images/pic/my-pic.jpg') }}" class="img-responsive" alt="">
                        </div>

                        <div class="c-padding">
                            <h3>Article By <a href="#" data-toggle="tooltip" data-placement="top" title="Visit Alex Website">{{ current_blog.user.nickname }}</a></h3>
                            <p>{{ current_blog.user.introduction_detail }}</p>
                        </div>
                    </div>
                    <!-- Post Author Bio Box End -->

                    <!-- You May Also Like Start -->
                    <div class="you-may-also-like margin-top-50 margin-bottom-50">
                        <h3>更多相关文章</h3>
                        <div class="row">

                            {% for recommend_blog in recommend_blog_list %}
                                <div class="col-md-4 col-sm-6 col-xs-12">
                                    <a href="{{ url_for('blog.blog_detail', blog_suffix=recommend_blog.url_suffix) }}">
                                        <p>{{ recommend_blog.title[:50] }}</p></a>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                    <!-- You May Also Like End -->

                    <!-- Post Comment (Disqus) Start -->
                    <div id="comment" class="comment">
                        <!-- TODO：评论  -->
                        <!-- <h3>Discuss about post</h3> -->


                    </div>
                    <!-- Post Comment (Disqus) End -->

                </div>
            </div>

        </div>

    </div>

    {{ super() }}

{% endblock %}